import Mock from 'mockjs'
// GET请求
const result = {
  code:0,
  data:null
}
console.log(1111)

// Mock.mock('/api/getData','get',(options)=>{
//   return {a:[]}
// })

Mock.mock(`/api/getData`,'post',(options)=>{
    const {body} = JSON.parse(options.body)
     if(body){
      const {type} = body;
      switch(type){
        case '1' : 
           return {
            ...result,
            data:{
              allIncome:20678,
              sealSingleCount:200.00,
              rechargeCount:64.00,
              customerPrice:99.99,
            }
           }
        case '2' :
          return {
            ...result,
            data:{
              allIncome:30,
              sealSingleCount:30,
              rechargeCount:30,
              customerPrice:30,
            }
           }
           case '3' :
            return {
              ...result,
              data:{
                allIncome:40,
                sealSingleCount:40,
                rechargeCount:40,
                customerPrice:40,
              }
            }
           case '4' :
          return {
            ...result,
            data:{
              allIncome:50,
              sealSingleCount:50,
              rechargeCount:50,
              customerPrice:50,
            }
            }
           case '5' :
          return {
            ...result,
            data:{
              allIncome:60,
              sealSingleCount:60,
              rechargeCount:60,
              customerPrice:60,
            }
            }
       }
     }else{
       return {
        code:-1,
        data:null,
        msg:'缺少参数'
       }
     }
})
// POST请求
Mock.mock('/api/postData','post',(options)=>{
  const {body} = options
  return {}
})